.with_stdout_contains("test bench_foo ... bench: [..]"));
}
+#[test]
+fn bench_all_exclude() {
+ if !is_nightly() { return }
+
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.1.0"
+
+ [workspace]
+ members = ["bar", "baz"]
+ "#)
+ .file("src/main.rs", r#"
+ fn main() {}
+ "#)
+ .file("bar/Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.1.0"
+ "#)
+ .file("bar/src/lib.rs", r#"
+ #![feature(test)]
+
+ extern crate test;
+
+ #[bench]
+ pub fn bar(b: &mut test::Bencher) {
+ b.iter(|| {});
+ }
+ "#)
+ .file("baz/Cargo.toml", r#"
+ [project]
+ name = "baz"
+ version = "0.1.0"
+ "#)
+ .file("baz/src/lib.rs", r#"
+ #[test]
+ pub fn baz() {
+ break_the_build();
+ }
+ "#);
+
+ assert_that(p.cargo_process("bench")
+ .arg("--all")
+ .arg("--exclude")
+ .arg("baz"),
+ execs().with_status(0)
+ .with_stdout_contains("\
+running 1 test
+test bar ... bench: 0 ns/iter (+/- 0)
+
+test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured"));
+}
+
#[test]
fn bench_all_virtual_manifest() {
if !is_nightly() { return }
[..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n"));
}
+#[test]
+fn build_all_exclude() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.1.0"
+
+ [workspace]
+ members = ["bar", "baz"]
+ "#)
+ .file("src/main.rs", r#"
+ fn main() {}
+ "#)
+ .file("bar/Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.1.0"
+ "#)
+ .file("bar/src/lib.rs", r#"
+ pub fn bar() {}
+ "#)
+ .file("baz/Cargo.toml", r#"
+ [project]
+ name = "baz"
+ version = "0.1.0"
+ "#)
+ .file("baz/src/lib.rs", r#"
+ pub fn baz() {
+ break_the_build();
+ }
+ "#);
+
+ assert_that(p.cargo_process("build")
+ .arg("--all")
+ .arg("--exclude")
+ .arg("baz"),
+ execs().with_status(0)
+ .with_stderr("[..] Compiling bar v0.1.0 ([..])\n\
+ [..] Compiling foo v0.1.0 ([..])\n\
+ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n"));
+}
+
#[test]
fn build_all_workspace_implicit_examples() {
let p = project("foo")
.with_stdout_contains("test bar_test ... ok"));
}
+#[test]
+fn test_all_exclude() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.1.0"
+
+ [workspace]
+ members = ["bar", "baz"]
+ "#)
+ .file("src/main.rs", r#"
+ fn main() {}
+ "#)
+ .file("bar/Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.1.0"
+ "#)
+ .file("bar/src/lib.rs", r#"
+ #[test]
+ pub fn bar() {}
+ "#)
+ .file("baz/Cargo.toml", r#"
+ [project]
+ name = "baz"
+ version = "0.1.0"
+ "#)
+ .file("baz/src/lib.rs", r#"
+ #[test]
+ pub fn baz() {
+ assert!(false);
+ }
+ "#);
+
+ assert_that(p.cargo_process("test")
+ .arg("--all")
+ .arg("--exclude")
+ .arg("baz"),
+ execs().with_status(0)
+ .with_stdout_contains("running 1 test
+test bar ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured"));
+}
+
#[test]
fn test_all_virtual_manifest() {
let p = project("workspace")